package com.lx.ngsl.exam.quest.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lx.ngsl.exam.quest.entity.ChoiceEntity;
import com.lx.ngsl.exam.quest.entity.WrongEntity;
import com.lx.ngsl.exam.quest.repository.WrongRepository;

@Service
public class MistakeService {

	@Autowired
	private WrongRepository repository;
	
	/*
	 * 查询用户错题id
	 */
	public List<String> getMistakeIds(String userId,String testId){
		return repository.wrongQuestIds(userId, testId);
	}
	/*
	 * 查询用户错误答案
	 */
	public String getMyAnswer(String questId,String userId,String testId,String type) {
		List<WrongEntity> mistake = repository.findByQuestIdAndUserIdAndTestId(questId, userId, testId);
		if(mistake == null || mistake.size() == 0) {
			return "";
		}
		return mistake.get(0).getAnwser();
	}
	
}
